package com.wxq.demo.controller;

import com.wxq.demo.bean.Book;
import com.wxq.demo.db1.service.Db1Service;
import com.wxq.demo.db2.service.Db2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TestController {
    @Autowired
    public Db1Service db1Service;

    @Autowired
    private Db2Service db2Service;

    @GetMapping("/test")
    public void test() {
        List<Book> books1 = db1Service.getAllBooks();
        List<Book> books2 = db2Service.getAllBooks();
        for (Book book : books1) {
            System.out.println("book1:" + book.getId() + ";" + book.getName() + ";" + book.getAuthor());
        }
        for (Book book : books2) {
            System.out.println("book2:" + book.getId() + ";" + book.getName() + ";" + book.getAuthor());
        }
    }
}
